<?php
class Colour {

    public function __construct() {
        $this->SQL = MySQL::getInstance();
        $this->langMgr = new Language();
    }

    /*
     * getAll - get all available colours
     * @return array of form (id, name, code) with id as key
     */
    public function getAll() {
        $ret = $this->SQL->fquery('
            SELECT id, name, code, language_key
            FROM colours
            ORDER BY name'
        );
        $data = array();
        foreach($ret as $row) {
            $data[$row['id']] = $row;
            $data[$row['id']]['lang'] = $this->langMgr->get($row['language_key']);
        }
        return $data;
    }
}
